package icu.makka.yygh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import icu.makka.yygh.mapper.HospitalSetMapper;
import icu.makka.yygh.model.hosp.Hospital;
import icu.makka.yygh.model.hosp.HospitalSet;
import icu.makka.yygh.service.HospitalSetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class HospitalSetServiceImpl extends ServiceImpl<HospitalSetMapper, HospitalSet> implements HospitalSetService {

    /**
     * 根据医院编码查询签名
     * @param hoscode
     */
    @Override
    public String getSignByHosCode(String hoscode) {
        log.info("业务层，根据医院编码查询签名，hoscode={}", hoscode);

        LambdaQueryWrapper<HospitalSet> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(hoscode != null, HospitalSet::getHoscode, hoscode);
        HospitalSet hospitalSet = this.getOne(queryWrapper);

        return hospitalSet.getSignKey();
    }
}
